package com.dahua.aopconfig;

import com.dahua.aop.UserService;
import com.dahua.util.CglibUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author chen_MingLiang
 * @version 1.0
 * @date 2020/1/29 18:48
 */
public class CustomAopBeanPostProcessor implements BeanPostProcessor {
	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (bean instanceof UserService) {
			bean = CglibUtil.getCglibProxy();
		}
		return bean;
	}
}
